import logging

log_handler = None  # 稍后主窗口将注入 QPlainTextEditHandler

def init_logging(handler: logging.Handler):
    global log_handler
    log_handler = handler

    logger = logging.getLogger()
    logger.setLevel(logging.DEBUG)
    logger.addHandler(log_handler)
